<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//Route::get('/', function () {
//    return view('welcome');
//});
Route::group(['prefix'=>'admin','namespace'=>'Admin'],function (){
    // 登录页
    Route::get('login','LoginController@login');
// 后台登录验证
    Route::post('dologin','LoginController@doLogin');
// 验证码
    Route::get('VCode','LoginController@VCode');
// 加密
    Route::get('jiami','LoginController@jiami');
    // 密码盐
    Route::get('build_ranstr','IndexController@build_ranstr');
    // 退出登录
    Route::get('logout','LoginController@logout');
});

// 发送邮件
Route::get('/queueSend','Admin\BookedController@queueSend');
// 测试mysql查询速度
Route::get('/updateMysql','Admin\BookedController@updateMysql');
// 缓存cache
Route::get('/cache','Admin\LoginController@Cache');
Route::get('/getCache','Admin\LoginController@getCache');

// 测试mysql查询速度
Route::get('/createMysql','Admin\BookedController@createMysql');

// 权限路由
Route::get('noaccess','Admin\LoginController@noaccess');

Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['isLogin','HasRole']],function (){
    // admin的index首页
    Route::get('index','IndexController@index');
    // 欢迎页
    Route::get('welcome','IndexController@welcome');

    // 后台模块相关路由
    Route::resource('admin','AdminController');
    // 删除选中id
    Route::post('admin/del','AdminController@delAll');

    // 角色管理模块
    Route::resource('role','RoleController');
    // 角色授权
    Route::get('role/auth/{id}','RoleController@auth');
    Route::post('role/doauth','RoleController@doAuth');
    // 删除选中id
    Route::post('role/del','RoleController@delAll');

    // 权限管理模块
    Route::resource('permission','PermissionController');
    // 删除选中id
    Route::post('permission/del','PermissionController@delAll');

    // 分类管理模块
    Route::resource('cate','CateController');
    // 修改排序
    Route::post('cate/changeorder','CateController@changeOrder');
    // 分类图标上传
    Route::post('cate/upload','CateController@upload');
    // 下载分类图标
    Route::get('cate/download/{key}','CateController@downLoad');

});







